﻿package mortal.game.view.arena.view
{
    import com.mui.controls.*;
    import mortal.common.global.*;
    import mortal.game.view.arena.data.*;
    import mortal.game.view.arena.util.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;

    public class ArenaPointRuleSpr extends GSprite
    {
        private var _bg:GImageBitmap;
        private var _pointMin:BitmapNumberText;
        private var _pointMax:BitmapNumberText;
        private var _coinMin:BitmapNumberText;
        private var _coinMax:BitmapNumberText;
        private var _split1:GTextFiled;
        private var _split2:GTextFiled;
        private var _index:int;

        public function ArenaPointRuleSpr()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.gImageBitmap("", 0, 0, this);
            this._pointMin = UIFactory.bitmapNumberText(92 + 28, 19 - 4, "GuildWarEnterNum.png", 28, 29, -16, this, 13, 1);
            this._pointMax = UIFactory.bitmapNumberText(92 + 28 + 85, 19 - 4, "GuildWarEnterNum.png", 28, 29, -16, this, 13, 1);
            this._coinMin = UIFactory.bitmapNumberText(195 + 22, 46 - 4, "GuildWarEnterNum.png", 28, 29, -16, this, 13, 1);
            this._coinMax = UIFactory.bitmapNumberText(228, 46 - 4, "GuildWarEnterNum.png", 28, 29, -16, this, 13, 1);
            this._split1 = UIFactory.gTextField("-", 92 + 28 + 70 - 34, 27 - 11, 14, 25, this, GlobalStyle.textFormatHuang.setSize(15));
            this._split2 = UIFactory.gTextField("-", 229, 54 - 11, 14, 25, this, GlobalStyle.textFormatHuang.setSize(15));
            return;
        }// end function

        public function set data(param1:ArenaDayRuleData) : void
        {
            var _loc_2:int = 0;
            var _loc_3:int = 0;
            var _loc_4:int = 0;
            if (param1)
            {
                this._pointMin.text = param1.pointMinValue + "";
                _loc_2 = ArenaUtil.getArenaInitScore();
                _loc_3 = param1.pointMaxValue > 1000000 ? (_loc_2 + 9999) : (param1.pointMaxValue);
                this._pointMax.text = _loc_3 + "";
                this._coinMin.text = param1.rewardMinValue + "";
                _loc_4 = param1.rewardMaxValue > 100000 ? (9999) : (param1.rewardMaxValue);
                this._coinMax.text = _loc_4 + "";
                this.updatePosition();
            }
            return;
        }// end function

        public function set bg(param1:String) : void
        {
            this._bg.imgUrl = param1;
            return;
        }// end function

        public function set index(param1:int) : void
        {
            this._index = param1;
            return;
        }// end function

        private function updatePosition() : void
        {
            switch(this._index)
            {
                case 0:
                {
                    this._coinMin.x = 195 + 22;
                    this._split2.x = this._coinMin.x + 37 - 21;
                    this._coinMax.x = this._coinMin.x + 42;
                    break;
                }
                case 1:
                {
                    this._coinMin.x = 195 + 22 - 10;
                    this._split2.x = this._coinMin.x + 37 - 20;
                    this._coinMax.x = this._coinMin.x + 45;
                    break;
                }
                case 2:
                {
                    this._coinMin.x = 195 + 22 - 36;
                    this._split2.x = this._coinMin.x + 50 - 24;
                    this._coinMax.x = this._coinMin.x + 62;
                    break;
                }
                case 3:
                {
                    this._pointMax.x = 92 + 28 + 85 + 13;
                    this._coinMin.x = 195 + 22 - 74;
                    this._split2.x = this._coinMin.x + 62 - 32;
                    this._coinMax.x = this._coinMin.x + 80;
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl();
            this._pointMin.dispose();
            this._pointMin = null;
            this._pointMax.dispose();
            this._pointMax = null;
            this._coinMin.dispose();
            this._coinMin = null;
            this._coinMax.dispose();
            this._coinMax = null;
            this._split1.dispose();
            this._split1 = null;
            this._split2.dispose();
            this._split2 = null;
            this._bg.dispose();
            this._bg = null;
            this._index = 0;
            return;
        }// end function

    }
}
